<template>
	<view>
		<view class="title">{{info.title||"佚名"}}</view>

		<view class="author">
			<text>投稿作者：{{info.author||"佚名"}}</text>
			<text>阅读量：{{info.read_num||'0'}}</text>
		</view>
		

		<view class="content">
			<u-parse :content="info.content"></u-parse>
		</view>
		<u-gap height="100rpx"></u-gap>
	</view>
</template>

<script>
	const db = uniCloud.database();
	const _ = db.command;
	export default {
		data() {
			return {
				info: {},
			}
		},
		async onLoad(options) {
			console.log('options', options);
		

			const aaa = await db.collection("a_article").where({
				_id: options.id
			}).get()
			this.info = aaa.result.data[0]

			const upReadNumber = await db.collection("a_article").where({
				_id: options.id
			}).update({
				read_num: aaa.result.data[0].read_num * 1 + 1
			})

		
		},
		methods: {

		}
	}
</script>

<style>
	.title {
		margin: 20rpx;
		text-align: center;
		font-weight: 600;
		font-size: 32rpx;
	}

	.author {
		display: flex;
		justify-content: space-between;
		margin: 20rpx;
		color: #888;
		font-size: 26rpx;
	}

	.content {
		font-size: 30rpx;
		letter-spacing: 2rpx;
		text-indent: 50rpx;
		text-align: justify;
		margin: 0 20rpx;
	}
</style>